15. Quiz: Match Inputs To Outputs
Test Your Loop Knowledge
In case you want to test any code for the quizzes that follow, there is a code editor at the bottom of this page where you can experiment.
QUIZ QUESTION::
Practice with range
For each below, match the input code to the appropriate output.
ANSWER CHOICES:
Input |
Output |
---|---|
print(list(range(4))) |
|
print(list(range(4,8))) |
|
print(list(range(4,10,2))) |
|
print(list(range(0,-5))) |
SOLUTION:
Input |
Output |
---|---|
print(list(range(4))) |
|
print(list(range(0,-5))) |
|
print(list(range(4,8))) |
|
print(list(range(4,10,2))) |
Use the code below to complete the next quiz.
colors = ['Red', 'Blue', 'Green', 'Purple']
lower_colors = [ ]
for color in colors:
#finish this part
SOLUTION:
lower_colors.append(color.lower())Start Quiz:
# Use the space here to practice whatever you would like pertaining to
# the above quizzes.